home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1988 April
/
Ahoy_Magazine_88-04_1988_Double_L.d64
/
Random Walk
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
477b
|
13 lines
1 rem =================================
2 rem commodares problem #48-2 :
3 rem random walk
4 rem solution by
5 rem judy groth
6 rem =================================
10 poke 53280,0:poke 53281,0:print"[147][154]";:sp=1024:sc=54272
20 cc(1)=2:m(1)=-40:cc(2)=6:m(2)=40:cc(3)=7:m(3)=-1:cc(4)=5:m(4)=1
30 a=int(rnd(1)*4)+1: uc=112+a: if a=4 then uc=107
40 s=sp+m(a):ifs<1024 or s>2023 then 30
50 poke sp,uc:pokesp+sc,cc(a):sp=sp+m(a):rem if peek(s)=32 then sp=sp+m(a)
60 poke sp,81:poke sp+sc,1:goto 30